<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span id="local-6989586621680850641"></span><span class="hs-comment">{-

Describes predicates as they are considered by the solver.

-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Core.Predicate</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-8"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#Pred"><span class="hs-identifier">Pred</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#classifyPredType"><span class="hs-identifier">classifyPredType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-9"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#isPredTy"><span class="hs-identifier">isPredTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isEvVarType"><span class="hs-identifier">isEvVarType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span>  </span><span class="hs-comment">-- Equality predicates</span><span>
</span><span id="line-12"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier">EqRel</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#eqRelRole"><span class="hs-identifier">eqRelRole</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#isEqPrimPred"><span class="hs-identifier">isEqPrimPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isEqPred"><span class="hs-identifier">isEqPred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-14"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#getEqPredTys"><span class="hs-identifier">getEqPredTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#getEqPredTys_maybe"><span class="hs-identifier">getEqPredTys_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#getEqPredRole"><span class="hs-identifier">getEqPredRole</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#predTypeEqRel"><span class="hs-identifier">predTypeEqRel</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>  </span><span class="annot"><a href="GHC.Core.Coercion.html#mkPrimEqPred"><span class="hs-identifier">mkPrimEqPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#mkReprPrimEqPred"><span class="hs-identifier">mkReprPrimEqPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#mkPrimEqPredRole"><span class="hs-identifier">mkPrimEqPredRole</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>  </span><span class="annot"><a href="GHC.Core.Coercion.html#mkHeteroPrimEqPred"><span class="hs-identifier">mkHeteroPrimEqPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#mkHeteroReprPrimEqPred"><span class="hs-identifier">mkHeteroReprPrimEqPred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>  </span><span class="hs-comment">-- Class predicates</span><span>
</span><span id="line-20"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier">mkClassPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isDictTy"><span class="hs-identifier">isDictTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#isClassPred"><span class="hs-identifier">isClassPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isEqPredClass"><span class="hs-identifier">isEqPredClass</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isCTupleClass"><span class="hs-identifier">isCTupleClass</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#getClassPredTys"><span class="hs-identifier">getClassPredTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#getClassPredTys_maybe"><span class="hs-identifier">getClassPredTys_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#classMethodTy"><span class="hs-identifier">classMethodTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#classMethodInstTy"><span class="hs-identifier">classMethodInstTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span>  </span><span class="hs-comment">-- Implicit parameters</span><span>
</span><span id="line-26"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#isIPLikePred"><span class="hs-identifier">isIPLikePred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#hasIPSuperClasses"><span class="hs-identifier">hasIPSuperClasses</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isIPTyCon"><span class="hs-identifier">isIPTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isIPClass"><span class="hs-identifier">isIPClass</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span>  </span><span class="hs-comment">-- Evidence variables</span><span>
</span><span id="line-29"></span><span>  </span><span class="annot"><a href="GHC.Types.Var.html#DictId"><span class="hs-identifier">DictId</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isEvVar"><span class="hs-identifier">isEvVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isDictId"><span class="hs-identifier">isDictId</span></a></span><span>
</span><span id="line-30"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Class.html"><span class="hs-identifier">GHC.Core.Class</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html"><span class="hs-identifier">GHC.Core.Coercion</span></a></span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier">scaledThing</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span class="hs-comment">-- | A predicate in the solver. The solver tries to prove Wanted predicates</span><span>
</span><span id="line-48"></span><span class="hs-comment">-- from Given ones.</span><span>
</span><span id="line-49"></span><span class="hs-keyword">data</span><span> </span><span id="Pred"><span class="annot"><a href="GHC.Core.Predicate.html#Pred"><span class="hs-identifier hs-var">Pred</span></a></span></span><span>
</span><span id="line-50"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="ClassPred"><span class="annot"><a href="GHC.Core.Predicate.html#ClassPred"><span class="hs-identifier hs-var">ClassPred</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-51"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="EqPred"><span class="annot"><a href="GHC.Core.Predicate.html#EqPred"><span class="hs-identifier hs-var">EqPred</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-52"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="IrredPred"><span class="annot"><a href="GHC.Core.Predicate.html#IrredPred"><span class="hs-identifier hs-var">IrredPred</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span>
</span><span id="line-53"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ForAllPred"><span class="annot"><a href="GHC.Core.Predicate.html#ForAllPred"><span class="hs-identifier hs-var">ForAllPred</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span>
</span><span id="line-54"></span><span>     </span><span class="hs-comment">-- ForAllPred: see Note [Quantified constraints] in GHC.Tc.Solver.Canonical</span><span>
</span><span id="line-55"></span><span>  </span><span class="hs-comment">-- NB: There is no TuplePred case</span><span>
</span><span id="line-56"></span><span>  </span><span class="hs-comment">--     Tuple predicates like (Eq a, Ord b) are just treated</span><span>
</span><span id="line-57"></span><span>  </span><span class="hs-comment">--     as ClassPred, as if we had a tuple class with two superclasses</span><span>
</span><span id="line-58"></span><span>  </span><span class="hs-comment">--        class (c1, c2) =&gt; (%,%) c1 c2</span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="annot"><a href="GHC.Core.Predicate.html#classifyPredType"><span class="hs-identifier hs-type">classifyPredType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#Pred"><span class="hs-identifier hs-type">Pred</span></a></span><span>
</span><span id="line-61"></span><span id="classifyPredType"><span class="annot"><span class="annottext">classifyPredType :: PredType -&gt; Pred
</span><a href="GHC.Core.Predicate.html#classifyPredType"><span class="hs-identifier hs-var hs-var">classifyPredType</span></a></span></span><span> </span><span id="local-6989586621680850572"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850572"><span class="hs-identifier hs-var">ev_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; PredType -&gt; Maybe (TyCon, [PredType])
PredType -&gt; Maybe (TyCon, [PredType])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850572"><span class="hs-identifier hs-var">ev_ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-62"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850570"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850570"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">PredType
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PredType
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850569"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850569"><span class="hs-identifier hs-var">ty1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850568"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850568"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-63"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850570"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#eqReprPrimTyConKey"><span class="hs-identifier hs-var">eqReprPrimTyConKey</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; PredType -&gt; PredType -&gt; Pred
</span><a href="GHC.Core.Predicate.html#EqPred"><span class="hs-identifier hs-var">EqPred</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850569"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850568"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-64"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850570"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#eqPrimTyConKey"><span class="hs-identifier hs-var">eqPrimTyConKey</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; PredType -&gt; PredType -&gt; Pred
</span><a href="GHC.Core.Predicate.html#EqPred"><span class="hs-identifier hs-var">EqPred</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850569"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850568"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850562"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850562"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850561"><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850561"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-67"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680850560"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850560"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe Class
</span><a href="GHC.Core.TyCon.html#tyConClass_maybe"><span class="hs-identifier hs-var">tyConClass_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850562"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-68"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [PredType] -&gt; Pred
</span><a href="GHC.Core.Predicate.html#ClassPred"><span class="hs-identifier hs-var">ClassPred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850560"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850561"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span>    </span><span class="annot"><span class="annottext">Maybe (TyCon, [PredType])
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850558"><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680850558"><span class="hs-identifier hs-var">tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850557"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850557"><span class="hs-identifier hs-var">rho</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; ([TyCoVar], PredType)
</span><a href="GHC.Core.Type.html#splitForAllTys"><span class="hs-identifier hs-var">splitForAllTys</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850572"><span class="hs-identifier hs-var">ev_ty</span></a></span><span>
</span><span id="line-71"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850555"><span class="annot"><span class="annottext">[Scaled PredType]
</span><a href="#local-6989586621680850555"><span class="hs-identifier hs-var">theta</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850554"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850554"><span class="hs-identifier hs-var">pred</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; ([Scaled PredType], PredType)
</span><a href="GHC.Core.Type.html#splitFunTys"><span class="hs-identifier hs-var">splitFunTys</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850557"><span class="hs-identifier hs-var">rho</span></a></span><span>
</span><span id="line-72"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyCoVar] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680850558"><span class="hs-identifier hs-var">tvs</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[Scaled PredType] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled PredType]
</span><a href="#local-6989586621680850555"><span class="hs-identifier hs-var">theta</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[TyCoVar] -&gt; [PredType] -&gt; PredType -&gt; Pred
</span><a href="GHC.Core.Predicate.html#ForAllPred"><span class="hs-identifier hs-var">ForAllPred</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680850558"><span class="hs-identifier hs-var">tvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled PredType -&gt; PredType) -&gt; [Scaled PredType] -&gt; [PredType]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled PredType -&gt; PredType
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled PredType]
</span><a href="#local-6989586621680850555"><span class="hs-identifier hs-var">theta</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850554"><span class="hs-identifier hs-var">pred</span></a></span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-76"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; Pred
</span><a href="GHC.Core.Predicate.html#IrredPred"><span class="hs-identifier hs-var">IrredPred</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850572"><span class="hs-identifier hs-var">ev_ty</span></a></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span class="hs-comment">-- --------------------- Dictionary types ---------------------------------</span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span class="annot"><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier hs-type">mkClassPred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span>
</span><span id="line-81"></span><span id="mkClassPred"><span class="annot"><span class="annottext">mkClassPred :: Class -&gt; [PredType] -&gt; PredType
</span><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier hs-var hs-var">mkClassPred</span></a></span></span><span> </span><span id="local-6989586621680850549"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850549"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621680850548"><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850548"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [PredType] -&gt; PredType
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; TyCon
</span><a href="GHC.Core.Class.html#classTyCon"><span class="hs-identifier hs-var hs-var">classTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850549"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850548"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span class="annot"><a href="GHC.Core.Predicate.html#isDictTy"><span class="hs-identifier hs-type">isDictTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-84"></span><span id="isDictTy"><span class="annot"><span class="annottext">isDictTy :: PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isDictTy"><span class="hs-identifier hs-var hs-var">isDictTy</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isClassPred"><span class="hs-identifier hs-var">isClassPred</span></a></span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span class="annot"><a href="GHC.Core.Predicate.html#getClassPredTys"><span class="hs-identifier hs-type">getClassPredTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-87"></span><span id="getClassPredTys"><span class="annot"><span class="annottext">getClassPredTys :: HasDebugCallStack =&gt; PredType -&gt; (Class, [PredType])
</span><a href="GHC.Core.Predicate.html#getClassPredTys"><span class="hs-identifier hs-var hs-var">getClassPredTys</span></a></span></span><span> </span><span id="local-6989586621680850541"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850541"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; Maybe (Class, [PredType])
</span><a href="GHC.Core.Predicate.html#getClassPredTys_maybe"><span class="hs-identifier hs-var">getClassPredTys_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850541"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-88"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850540"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850540"><span class="hs-identifier hs-var">clas</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850539"><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850539"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850540"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850539"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-89"></span><span>        </span><span class="annot"><span class="annottext">Maybe (Class, [PredType])
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; (Class, [PredType])
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getClassPredTys&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PredType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850541"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span class="annot"><a href="GHC.Core.Predicate.html#getClassPredTys_maybe"><span class="hs-identifier hs-type">getClassPredTys_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-92"></span><span id="getClassPredTys_maybe"><span class="annot"><span class="annottext">getClassPredTys_maybe :: PredType -&gt; Maybe (Class, [PredType])
</span><a href="GHC.Core.Predicate.html#getClassPredTys_maybe"><span class="hs-identifier hs-var hs-var">getClassPredTys_maybe</span></a></span></span><span> </span><span id="local-6989586621680850536"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850536"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; PredType -&gt; Maybe (TyCon, [PredType])
PredType -&gt; Maybe (TyCon, [PredType])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850536"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-93"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850535"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850535"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850534"><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850534"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680850533"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850533"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe Class
</span><a href="GHC.Core.TyCon.html#tyConClass_maybe"><span class="hs-identifier hs-var">tyConClass_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850535"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Class, [PredType]) -&gt; Maybe (Class, [PredType])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850533"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850534"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-94"></span><span>        </span><span class="annot"><span class="annottext">Maybe (TyCon, [PredType])
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Class, [PredType])
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-95"></span><span>
</span><span id="line-96"></span><span class="annot"><a href="GHC.Core.Predicate.html#classMethodTy"><span class="hs-identifier hs-type">classMethodTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-97"></span><span class="hs-comment">-- Takes a class selector op :: forall a. C a =&gt; meth_ty</span><span>
</span><span id="line-98"></span><span class="hs-comment">-- and returns the type of its method, meth_ty</span><span>
</span><span id="line-99"></span><span class="hs-comment">-- The selector can be a superclass selector, in which case</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- you get back a superclass</span><span>
</span><span id="line-101"></span><span id="classMethodTy"><span class="annot"><span class="annottext">classMethodTy :: TyCoVar -&gt; PredType
</span><a href="GHC.Core.Predicate.html#classMethodTy"><span class="hs-identifier hs-var hs-var">classMethodTy</span></a></span></span><span> </span><span id="local-6989586621680850531"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850531"><span class="hs-identifier hs-var">sel_id</span></a></span></span><span>
</span><span id="line-102"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; PredType
</span><a href="GHC.Core.Type.html#funResultTy"><span class="hs-identifier hs-var">funResultTy</span></a></span><span> </span><span class="annot"><span class="annottext">(PredType -&gt; PredType) -&gt; PredType -&gt; PredType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>        </span><span class="hs-comment">-- meth_ty</span><span>
</span><span id="line-103"></span><span>    </span><span class="annot"><span class="annottext">PredType -&gt; PredType
</span><a href="GHC.Core.Type.html#dropForAlls"><span class="hs-identifier hs-var">dropForAlls</span></a></span><span> </span><span class="annot"><span class="annottext">(PredType -&gt; PredType) -&gt; PredType -&gt; PredType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>        </span><span class="hs-comment">-- C a =&gt; meth_ty</span><span>
</span><span id="line-104"></span><span>    </span><span class="annot"><span class="annottext">TyCoVar -&gt; PredType
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850531"><span class="hs-identifier hs-var">sel_id</span></a></span><span>        </span><span class="hs-comment">-- forall a. C n =&gt; meth_ty</span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span class="annot"><a href="GHC.Core.Predicate.html#classMethodInstTy"><span class="hs-identifier hs-type">classMethodInstTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-107"></span><span class="hs-comment">-- Takes a class selector op :: forall a b. C a b =&gt; meth_ty</span><span>
</span><span id="line-108"></span><span class="hs-comment">-- and the types [ty1, ty2] at which it is instantiated,</span><span>
</span><span id="line-109"></span><span class="hs-comment">-- returns the instantiated type of its method, meth_ty[t1/a,t2/b]</span><span>
</span><span id="line-110"></span><span class="hs-comment">-- The selector can be a superclass selector, in which case</span><span>
</span><span id="line-111"></span><span class="hs-comment">-- you get back a superclass</span><span>
</span><span id="line-112"></span><span id="classMethodInstTy"><span class="annot"><span class="annottext">classMethodInstTy :: TyCoVar -&gt; [PredType] -&gt; PredType
</span><a href="GHC.Core.Predicate.html#classMethodInstTy"><span class="hs-identifier hs-var hs-var">classMethodInstTy</span></a></span></span><span> </span><span id="local-6989586621680850527"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850527"><span class="hs-identifier hs-var">sel_id</span></a></span></span><span> </span><span id="local-6989586621680850526"><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850526"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span>
</span><span id="line-113"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; PredType
</span><a href="GHC.Core.Type.html#funResultTy"><span class="hs-identifier hs-var">funResultTy</span></a></span><span> </span><span class="annot"><span class="annottext">(PredType -&gt; PredType) -&gt; PredType -&gt; PredType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-114"></span><span>    </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; PredType -&gt; [PredType] -&gt; PredType
PredType -&gt; [PredType] -&gt; PredType
</span><a href="GHC.Core.Type.html#piResultTys"><span class="hs-identifier hs-var">piResultTys</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; PredType
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850527"><span class="hs-identifier hs-var">sel_id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850526"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span class="hs-comment">-- --------------------- Equality predicates ---------------------------------</span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span class="hs-comment">-- | A choice of equality relation. This is separate from the type 'Role'</span><span>
</span><span id="line-119"></span><span class="hs-comment">-- because 'Phantom' does not define a (non-trivial) equality relation.</span><span>
</span><span id="line-120"></span><span class="hs-keyword">data</span><span> </span><span id="EqRel"><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-var">EqRel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="NomEq"><span class="annot"><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="ReprEq"><span class="annot"><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span></span><span>
</span><span id="line-121"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850521"><span id="local-6989586621680850523"><span class="annot"><span class="annottext">EqRel -&gt; EqRel -&gt; Bool
(EqRel -&gt; EqRel -&gt; Bool) -&gt; (EqRel -&gt; EqRel -&gt; Bool) -&gt; Eq EqRel
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: EqRel -&gt; EqRel -&gt; Bool
$c/= :: EqRel -&gt; EqRel -&gt; Bool
== :: EqRel -&gt; EqRel -&gt; Bool
$c== :: EqRel -&gt; EqRel -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850501"><span id="local-6989586621680850503"><span id="local-6989586621680850506"><span id="local-6989586621680850509"><span id="local-6989586621680850512"><span id="local-6989586621680850514"><span id="local-6989586621680850516"><span class="annot"><span class="annottext">Eq EqRel
Eq EqRel
-&gt; (EqRel -&gt; EqRel -&gt; Ordering)
-&gt; (EqRel -&gt; EqRel -&gt; Bool)
-&gt; (EqRel -&gt; EqRel -&gt; Bool)
-&gt; (EqRel -&gt; EqRel -&gt; Bool)
-&gt; (EqRel -&gt; EqRel -&gt; Bool)
-&gt; (EqRel -&gt; EqRel -&gt; EqRel)
-&gt; (EqRel -&gt; EqRel -&gt; EqRel)
-&gt; Ord EqRel
EqRel -&gt; EqRel -&gt; Bool
EqRel -&gt; EqRel -&gt; Ordering
EqRel -&gt; EqRel -&gt; EqRel
forall a.
Eq a
-&gt; (a -&gt; a -&gt; Ordering)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; Ord a
min :: EqRel -&gt; EqRel -&gt; EqRel
$cmin :: EqRel -&gt; EqRel -&gt; EqRel
max :: EqRel -&gt; EqRel -&gt; EqRel
$cmax :: EqRel -&gt; EqRel -&gt; EqRel
&gt;= :: EqRel -&gt; EqRel -&gt; Bool
$c&gt;= :: EqRel -&gt; EqRel -&gt; Bool
&gt; :: EqRel -&gt; EqRel -&gt; Bool
$c&gt; :: EqRel -&gt; EqRel -&gt; Bool
&lt;= :: EqRel -&gt; EqRel -&gt; Bool
$c&lt;= :: EqRel -&gt; EqRel -&gt; Bool
&lt; :: EqRel -&gt; EqRel -&gt; Bool
$c&lt; :: EqRel -&gt; EqRel -&gt; Bool
compare :: EqRel -&gt; EqRel -&gt; Ordering
$ccompare :: EqRel -&gt; EqRel -&gt; Ordering
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Ord</span></span></span></span></span></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680850497"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-124"></span><span>  </span><span id="local-6989586621680850495"><span class="annot"><span class="annottext">ppr :: EqRel -&gt; SDoc
</span><a href="#local-6989586621680850495"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;nominal equality&quot;</span></span><span>
</span><span id="line-125"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;representational equality&quot;</span></span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span class="annot"><a href="GHC.Core.Predicate.html#eqRelRole"><span class="hs-identifier hs-type">eqRelRole</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span>
</span><span id="line-128"></span><span id="eqRelRole"><span class="annot"><span class="annottext">eqRelRole :: EqRel -&gt; Role
</span><a href="GHC.Core.Predicate.html#eqRelRole"><span class="hs-identifier hs-var hs-var">eqRelRole</span></a></span></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span>
</span><span id="line-129"></span><span class="annot"><a href="GHC.Core.Predicate.html#eqRelRole"><span class="hs-identifier hs-var">eqRelRole</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span class="annot"><a href="GHC.Core.Predicate.html#getEqPredTys"><span class="hs-identifier hs-type">getEqPredTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-132"></span><span id="getEqPredTys"><span class="annot"><span class="annottext">getEqPredTys :: PredType -&gt; (PredType, PredType)
</span><a href="GHC.Core.Predicate.html#getEqPredTys"><span class="hs-identifier hs-var hs-var">getEqPredTys</span></a></span></span><span> </span><span id="local-6989586621680850491"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850491"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-133"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; PredType -&gt; Maybe (TyCon, [PredType])
PredType -&gt; Maybe (TyCon, [PredType])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850491"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-134"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850490"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850490"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">PredType
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PredType
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850489"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850489"><span class="hs-identifier hs-var">ty1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850488"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850488"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-135"></span><span>        </span><span class="hs-glyph">|</span><span>  </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850490"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#eqPrimTyConKey"><span class="hs-identifier hs-var">eqPrimTyConKey</span></a></span><span>
</span><span id="line-136"></span><span>        </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850490"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#eqReprPrimTyConKey"><span class="hs-identifier hs-var">eqReprPrimTyConKey</span></a></span><span>
</span><span id="line-137"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850489"><span class="hs-identifier hs-var">ty1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850488"><span class="hs-identifier hs-var">ty2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-138"></span><span>      </span><span class="annot"><span class="annottext">Maybe (TyCon, [PredType])
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; (PredType, PredType)
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getEqPredTys&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PredType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850491"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span class="annot"><a href="GHC.Core.Predicate.html#getEqPredTys_maybe"><span class="hs-identifier hs-type">getEqPredTys_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span id="getEqPredTys_maybe"><span class="annot"><span class="annottext">getEqPredTys_maybe :: PredType -&gt; Maybe (Role, PredType, PredType)
</span><a href="GHC.Core.Predicate.html#getEqPredTys_maybe"><span class="hs-identifier hs-var hs-var">getEqPredTys_maybe</span></a></span></span><span> </span><span id="local-6989586621680850486"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850486"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-142"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; PredType -&gt; Maybe (TyCon, [PredType])
PredType -&gt; Maybe (TyCon, [PredType])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850486"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-143"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850485"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850485"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">PredType
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PredType
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850484"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850484"><span class="hs-identifier hs-var">ty1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850483"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850483"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-144"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850485"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#eqPrimTyConKey"><span class="hs-identifier hs-var">eqPrimTyConKey</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Role, PredType, PredType) -&gt; Maybe (Role, PredType, PredType)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850484"><span class="hs-identifier hs-var">ty1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850483"><span class="hs-identifier hs-var">ty2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-145"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850485"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#eqReprPrimTyConKey"><span class="hs-identifier hs-var">eqReprPrimTyConKey</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Role, PredType, PredType) -&gt; Maybe (Role, PredType, PredType)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850484"><span class="hs-identifier hs-var">ty1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850483"><span class="hs-identifier hs-var">ty2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-146"></span><span>      </span><span class="annot"><span class="annottext">Maybe (TyCon, [PredType])
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Role, PredType, PredType)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span class="annot"><a href="GHC.Core.Predicate.html#getEqPredRole"><span class="hs-identifier hs-type">getEqPredRole</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span>
</span><span id="line-149"></span><span id="getEqPredRole"><span class="annot"><span class="annottext">getEqPredRole :: PredType -&gt; Role
</span><a href="GHC.Core.Predicate.html#getEqPredRole"><span class="hs-identifier hs-var hs-var">getEqPredRole</span></a></span></span><span> </span><span id="local-6989586621680850482"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850482"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; Role
</span><a href="GHC.Core.Predicate.html#eqRelRole"><span class="hs-identifier hs-var">eqRelRole</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PredType -&gt; EqRel
</span><a href="GHC.Core.Predicate.html#predTypeEqRel"><span class="hs-identifier hs-var">predTypeEqRel</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850482"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span class="hs-comment">-- | Get the equality relation relevant for a pred type.</span><span>
</span><span id="line-152"></span><span class="annot"><a href="GHC.Core.Predicate.html#predTypeEqRel"><span class="hs-identifier hs-type">predTypeEqRel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span>
</span><span id="line-153"></span><span id="predTypeEqRel"><span class="annot"><span class="annottext">predTypeEqRel :: PredType -&gt; EqRel
</span><a href="GHC.Core.Predicate.html#predTypeEqRel"><span class="hs-identifier hs-var hs-var">predTypeEqRel</span></a></span></span><span> </span><span id="local-6989586621680850481"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850481"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-154"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850480"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850480"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[PredType]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; PredType -&gt; Maybe (TyCon, [PredType])
PredType -&gt; Maybe (TyCon, [PredType])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850481"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-155"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850480"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#eqReprPrimTyConKey"><span class="hs-identifier hs-var">eqReprPrimTyConKey</span></a></span><span>
</span><span id="line-156"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span>
</span><span id="line-157"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-158"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span class="hs-comment">{-------------------------------------------
Predicates on PredType
--------------------------------------------}</span><span>
</span><span id="line-163"></span><span>
</span><span id="line-164"></span><span class="hs-comment">{-
Note [Evidence for quantified constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The superclass mechanism in GHC.Tc.Solver.Canonical.makeSuperClasses risks
taking a quantified constraint like
   (forall a. C a =&gt; a ~ b)
and generate superclass evidence
   (forall a. C a =&gt; a ~# b)

This is a funny thing: neither isPredTy nor isCoVarType are true
of it.  So we are careful not to generate it in the first place:
see Note [Equality superclasses in quantified constraints]
in GHC.Tc.Solver.Canonical.
-}</span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span class="annot"><a href="GHC.Core.Predicate.html#isEvVarType"><span class="hs-identifier hs-type">isEvVarType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-180"></span><span class="hs-comment">-- True of (a) predicates, of kind Constraint, such as (Eq a), and (a ~ b)</span><span>
</span><span id="line-181"></span><span class="hs-comment">--         (b) coercion types, such as (t1 ~# t2) or (t1 ~R# t2)</span><span>
</span><span id="line-182"></span><span class="hs-comment">-- See Note [Types for coercions, predicates, and evidence] in GHC.Core.TyCo.Rep</span><span>
</span><span id="line-183"></span><span class="hs-comment">-- See Note [Evidence for quantified constraints]</span><span>
</span><span id="line-184"></span><span id="isEvVarType"><span class="annot"><span class="annottext">isEvVarType :: PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isEvVarType"><span class="hs-identifier hs-var hs-var">isEvVarType</span></a></span></span><span> </span><span id="local-6989586621680850479"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850479"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; Bool
</span><a href="GHC.Core.Type.html#isCoVarType"><span class="hs-identifier hs-var">isCoVarType</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850479"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; PredType -&gt; Bool
PredType -&gt; Bool
</span><a href="GHC.Core.Type.html#isPredTy"><span class="hs-identifier hs-var">isPredTy</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850479"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-185"></span><span>
</span><span id="line-186"></span><span class="annot"><a href="GHC.Core.Predicate.html#isEqPredClass"><span class="hs-identifier hs-type">isEqPredClass</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-187"></span><span class="hs-comment">-- True of (~) and (~~)</span><span>
</span><span id="line-188"></span><span id="isEqPredClass"><span class="annot"><span class="annottext">isEqPredClass :: Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isEqPredClass"><span class="hs-identifier hs-var hs-var">isEqPredClass</span></a></span></span><span> </span><span id="local-6989586621680850477"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850477"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850477"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">Class -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#eqTyConKey"><span class="hs-identifier hs-var">eqTyConKey</span></a></span><span>
</span><span id="line-189"></span><span>                  </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850477"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">Class -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#heqTyConKey"><span class="hs-identifier hs-var">heqTyConKey</span></a></span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span class="annot"><a href="GHC.Core.Predicate.html#isClassPred"><span class="hs-identifier hs-type">isClassPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isEqPred"><span class="hs-identifier hs-type">isEqPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isEqPrimPred"><span class="hs-identifier hs-type">isEqPrimPred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-192"></span><span id="isClassPred"><span class="annot"><span class="annottext">isClassPred :: PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isClassPred"><span class="hs-identifier hs-var hs-var">isClassPred</span></a></span></span><span> </span><span id="local-6989586621680850474"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850474"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; Maybe TyCon
</span><a href="GHC.Core.Type.html#tyConAppTyCon_maybe"><span class="hs-identifier hs-var">tyConAppTyCon_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850474"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-193"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680850472"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850472"><span class="hs-identifier hs-var">tyCon</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isClassTyCon"><span class="hs-identifier hs-var">isClassTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850472"><span class="hs-identifier hs-var">tyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-194"></span><span>    </span><span class="annot"><span class="annottext">Maybe TyCon
</span><span class="hs-identifier">_</span></span><span>                               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span id="isEqPred"><span class="annot"><span class="annottext">isEqPred :: PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isEqPred"><span class="hs-identifier hs-var hs-var">isEqPred</span></a></span></span><span> </span><span id="local-6989586621680850470"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850470"><span class="hs-identifier hs-var">ty</span></a></span></span><span>  </span><span class="hs-comment">-- True of (a ~ b) and (a ~~ b)</span><span>
</span><span id="line-197"></span><span>             </span><span class="hs-comment">-- ToDo: should we check saturation?</span><span>
</span><span id="line-198"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680850469"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850469"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; Maybe TyCon
</span><a href="GHC.Core.Type.html#tyConAppTyCon_maybe"><span class="hs-identifier hs-var">tyConAppTyCon_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850470"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-199"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680850468"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850468"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe Class
</span><a href="GHC.Core.TyCon.html#tyConClass_maybe"><span class="hs-identifier hs-var">tyConClass_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850469"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-200"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isEqPredClass"><span class="hs-identifier hs-var">isEqPredClass</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850468"><span class="hs-identifier hs-var">cls</span></a></span><span>
</span><span id="line-201"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-202"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span id="isEqPrimPred"><span class="annot"><span class="annottext">isEqPrimPred :: PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isEqPrimPred"><span class="hs-identifier hs-var hs-var">isEqPrimPred</span></a></span></span><span> </span><span id="local-6989586621680850467"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850467"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; Bool
</span><a href="GHC.Core.Type.html#isCoVarType"><span class="hs-identifier hs-var">isCoVarType</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850467"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-205"></span><span>  </span><span class="hs-comment">-- True of (a ~# b) (a ~R# b)</span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span class="annot"><a href="GHC.Core.Predicate.html#isCTupleClass"><span class="hs-identifier hs-type">isCTupleClass</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-208"></span><span id="isCTupleClass"><span class="annot"><span class="annottext">isCTupleClass :: Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isCTupleClass"><span class="hs-identifier hs-var hs-var">isCTupleClass</span></a></span></span><span> </span><span id="local-6989586621680850466"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850466"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isTupleTyCon"><span class="hs-identifier hs-var">isTupleTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; TyCon
</span><a href="GHC.Core.Class.html#classTyCon"><span class="hs-identifier hs-var hs-var">classTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850466"><span class="hs-identifier hs-var">cls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
              Implicit parameters
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-216"></span><span>
</span><span id="line-217"></span><span class="annot"><a href="GHC.Core.Predicate.html#isIPTyCon"><span class="hs-identifier hs-type">isIPTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-218"></span><span id="isIPTyCon"><span class="annot"><span class="annottext">isIPTyCon :: TyCon -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isIPTyCon"><span class="hs-identifier hs-var hs-var">isIPTyCon</span></a></span></span><span> </span><span id="local-6989586621680850464"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850464"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850464"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#ipClassKey"><span class="hs-identifier hs-var">ipClassKey</span></a></span><span>
</span><span id="line-219"></span><span>  </span><span class="hs-comment">-- Class and its corresponding TyCon have the same Unique</span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span class="annot"><a href="GHC.Core.Predicate.html#isIPClass"><span class="hs-identifier hs-type">isIPClass</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-222"></span><span id="isIPClass"><span class="annot"><span class="annottext">isIPClass :: Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isIPClass"><span class="hs-identifier hs-var hs-var">isIPClass</span></a></span></span><span> </span><span id="local-6989586621680850462"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850462"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850462"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">Class -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#ipClassKey"><span class="hs-identifier hs-var">ipClassKey</span></a></span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span class="annot"><a href="GHC.Core.Predicate.html#isIPLikePred"><span class="hs-identifier hs-type">isIPLikePred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-225"></span><span class="hs-comment">-- See Note [Local implicit parameters]</span><span>
</span><span id="line-226"></span><span id="isIPLikePred"><span class="annot"><span class="annottext">isIPLikePred :: PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isIPLikePred"><span class="hs-identifier hs-var hs-var">isIPLikePred</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RecTcChecker -&gt; PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#is_ip_like_pred"><span class="hs-identifier hs-var">is_ip_like_pred</span></a></span><span> </span><span class="annot"><span class="annottext">RecTcChecker
</span><a href="GHC.Core.Predicate.html#initIPRecTc"><span class="hs-identifier hs-var">initIPRecTc</span></a></span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span>
</span><span id="line-229"></span><span class="annot"><a href="GHC.Core.Predicate.html#is_ip_like_pred"><span class="hs-identifier hs-type">is_ip_like_pred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#RecTcChecker"><span class="hs-identifier hs-type">RecTcChecker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-230"></span><span id="is_ip_like_pred"><span class="annot"><span class="annottext">is_ip_like_pred :: RecTcChecker -&gt; PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#is_ip_like_pred"><span class="hs-identifier hs-var hs-var">is_ip_like_pred</span></a></span></span><span> </span><span id="local-6989586621680850459"><span class="annot"><span class="annottext">RecTcChecker
</span><a href="#local-6989586621680850459"><span class="hs-identifier hs-var">rec_clss</span></a></span></span><span> </span><span id="local-6989586621680850458"><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850458"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-231"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680850457"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850457"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680850456"><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850456"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; PredType -&gt; Maybe (TyCon, [PredType])
PredType -&gt; Maybe (TyCon, [PredType])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">PredType
</span><a href="#local-6989586621680850458"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-232"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680850455"><span class="annot"><span class="annottext">RecTcChecker
</span><a href="#local-6989586621680850455"><span class="hs-identifier hs-var">rec_clss'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isTupleTyCon"><span class="hs-identifier hs-var">isTupleTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850457"><span class="hs-identifier hs-var">tc</span></a></span><span>  </span><span class="hs-comment">-- Tuples never cause recursion</span><span>
</span><span id="line-233"></span><span>                      </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">RecTcChecker -&gt; Maybe RecTcChecker
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">RecTcChecker
</span><a href="#local-6989586621680850459"><span class="hs-identifier hs-var">rec_clss</span></a></span><span>
</span><span id="line-234"></span><span>                      </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">RecTcChecker -&gt; TyCon -&gt; Maybe RecTcChecker
</span><a href="GHC.Core.TyCon.html#checkRecTc"><span class="hs-identifier hs-var">checkRecTc</span></a></span><span> </span><span class="annot"><span class="annottext">RecTcChecker
</span><a href="#local-6989586621680850459"><span class="hs-identifier hs-var">rec_clss</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850457"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-235"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680850453"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850453"><span class="hs-identifier hs-var">cls</span></a></span></span><span>       </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe Class
</span><a href="GHC.Core.TyCon.html#tyConClass_maybe"><span class="hs-identifier hs-var">tyConClass_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680850457"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-236"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isIPClass"><span class="hs-identifier hs-var">isIPClass</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850453"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">RecTcChecker -&gt; Class -&gt; [PredType] -&gt; Bool
</span><a href="GHC.Core.Predicate.html#has_ip_super_classes"><span class="hs-identifier hs-var">has_ip_super_classes</span></a></span><span> </span><span class="annot"><span class="annottext">RecTcChecker
</span><a href="#local-6989586621680850455"><span class="hs-identifier hs-var">rec_clss'</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850453"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850456"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-237"></span><span>
</span><span id="line-238"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-239"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">-- Includes things like (D []) where D is</span><span>
</span><span id="line-240"></span><span>          </span><span class="hs-comment">-- a Constraint-ranged family; #7785</span><span>
</span><span id="line-241"></span><span>
</span><span id="line-242"></span><span class="annot"><a href="GHC.Core.Predicate.html#hasIPSuperClasses"><span class="hs-identifier hs-type">hasIPSuperClasses</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-243"></span><span class="hs-comment">-- See Note [Local implicit parameters]</span><span>
</span><span id="line-244"></span><span id="hasIPSuperClasses"><span class="annot"><span class="annottext">hasIPSuperClasses :: Class -&gt; [PredType] -&gt; Bool
</span><a href="GHC.Core.Predicate.html#hasIPSuperClasses"><span class="hs-identifier hs-var hs-var">hasIPSuperClasses</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RecTcChecker -&gt; Class -&gt; [PredType] -&gt; Bool
</span><a href="GHC.Core.Predicate.html#has_ip_super_classes"><span class="hs-identifier hs-var">has_ip_super_classes</span></a></span><span> </span><span class="annot"><span class="annottext">RecTcChecker
</span><a href="GHC.Core.Predicate.html#initIPRecTc"><span class="hs-identifier hs-var">initIPRecTc</span></a></span><span>
</span><span id="line-245"></span><span>
</span><span id="line-246"></span><span class="annot"><a href="GHC.Core.Predicate.html#has_ip_super_classes"><span class="hs-identifier hs-type">has_ip_super_classes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#RecTcChecker"><span class="hs-identifier hs-type">RecTcChecker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-247"></span><span id="has_ip_super_classes"><span class="annot"><span class="annottext">has_ip_super_classes :: RecTcChecker -&gt; Class -&gt; [PredType] -&gt; Bool
</span><a href="GHC.Core.Predicate.html#has_ip_super_classes"><span class="hs-identifier hs-var hs-var">has_ip_super_classes</span></a></span></span><span> </span><span id="local-6989586621680850451"><span class="annot"><span class="annottext">RecTcChecker
</span><a href="#local-6989586621680850451"><span class="hs-identifier hs-var">rec_clss</span></a></span></span><span> </span><span id="local-6989586621680850450"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850450"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span id="local-6989586621680850449"><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850449"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-248"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCoVar -&gt; Bool) -&gt; [TyCoVar] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Bool
</span><a href="#local-6989586621680850447"><span class="hs-identifier hs-var">ip_ish</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; [TyCoVar]
</span><a href="GHC.Core.Class.html#classSCSelIds"><span class="hs-identifier hs-var">classSCSelIds</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680850450"><span class="hs-identifier hs-var">cls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-249"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-250"></span><span>    </span><span class="hs-comment">-- Check that the type of a superclass determines its value</span><span>
</span><span id="line-251"></span><span>    </span><span class="hs-comment">-- sc_sel_id :: forall a b. C a b -&gt; &lt;superclass type&gt;</span><span>
</span><span id="line-252"></span><span>    </span><span id="local-6989586621680850447"><span class="annot"><span class="annottext">ip_ish :: TyCoVar -&gt; Bool
</span><a href="#local-6989586621680850447"><span class="hs-identifier hs-var hs-var">ip_ish</span></a></span></span><span> </span><span id="local-6989586621680850445"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850445"><span class="hs-identifier hs-var">sc_sel_id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RecTcChecker -&gt; PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#is_ip_like_pred"><span class="hs-identifier hs-var">is_ip_like_pred</span></a></span><span> </span><span class="annot"><span class="annottext">RecTcChecker
</span><a href="#local-6989586621680850451"><span class="hs-identifier hs-var">rec_clss</span></a></span><span> </span><span class="annot"><span class="annottext">(PredType -&gt; Bool) -&gt; PredType -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-253"></span><span>                       </span><span class="annot"><span class="annottext">TyCoVar -&gt; [PredType] -&gt; PredType
</span><a href="GHC.Core.Predicate.html#classMethodInstTy"><span class="hs-identifier hs-var">classMethodInstTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850445"><span class="hs-identifier hs-var">sc_sel_id</span></a></span><span> </span><span class="annot"><span class="annottext">[PredType]
</span><a href="#local-6989586621680850449"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-254"></span><span>
</span><span id="line-255"></span><span class="annot"><a href="GHC.Core.Predicate.html#initIPRecTc"><span class="hs-identifier hs-type">initIPRecTc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#RecTcChecker"><span class="hs-identifier hs-type">RecTcChecker</span></a></span><span>
</span><span id="line-256"></span><span id="initIPRecTc"><span class="annot"><span class="annottext">initIPRecTc :: RecTcChecker
</span><a href="GHC.Core.Predicate.html#initIPRecTc"><span class="hs-identifier hs-var hs-var">initIPRecTc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; RecTcChecker -&gt; RecTcChecker
</span><a href="GHC.Core.TyCon.html#setRecTcMaxBound"><span class="hs-identifier hs-var">setRecTcMaxBound</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">RecTcChecker
</span><a href="GHC.Core.TyCon.html#initRecTc"><span class="hs-identifier hs-var">initRecTc</span></a></span><span>
</span><span id="line-257"></span><span>
</span><span id="line-258"></span><span class="hs-comment">{- Note [Local implicit parameters]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The function isIPLikePred tells if this predicate, or any of its
superclasses, is an implicit parameter.

Why are implicit parameters special?  Unlike normal classes, we can
have local instances for implicit parameters, in the form of
   let ?x = True in ...
So in various places we must be careful not to assume that any value
of the right type will do; we must carefully look for the innermost binding.
So isIPLikePred checks whether this is an implicit parameter, or has
a superclass that is an implicit parameter.

Several wrinkles

* We must be careful with superclasses, as #18649 showed.  Haskell
  doesn't allow an implicit parameter as a superclass
    class (?x::a) =&gt; C a where ...
  but with a constraint tuple we might have
     (% Eq a, ?x::Int %)
  and /its/ superclasses, namely (Eq a) and (?x::Int), /do/ include an
  implicit parameter.

  With ConstraintKinds this can apply to /any/ class, e.g.
     class sc =&gt; C sc where ...
  Then (C (?x::Int)) has (?x::Int) as a superclass.  So we must
  instantiate and check each superclass, one by one, in
  hasIPSuperClasses.

* With -XRecursiveSuperClasses, the superclass hunt can go on forever,
  so we need a RecTcChecker to cut it off.

* Another apparent additional complexity involves type families. For
  example, consider
         type family D (v::*-&gt;*) :: Constraint
         type instance D [] = ()
         f :: D v =&gt; v Char -&gt; Int
  If we see a call (f &quot;foo&quot;), we'll pass a &quot;dictionary&quot;
    () |&gt; (g :: () ~ D [])
  and it's good to specialise f at this dictionary.

So the question is: can an implicit parameter &quot;hide inside&quot; a
type-family constraint like (D a).  Well, no.  We don't allow
        type instance D Maybe = ?x:Int
Hence the umbrella 'otherwise' case in is_ip_like_pred.  See #7785.

Small worries (Sept 20):
* I don't see what stops us having that 'type instance'. Indeed I
  think nothing does.
* I'm a little concerned about type variables; such a variable might
  be instantiated to an implicit parameter.  I don't think this
  matters in the cases for which isIPLikePred is used, and it's pretty
  obscure anyway.
* The superclass hunt stops when it encounters the same class again,
  but in principle we could have the same class, differently instantiated,
  and the second time it could have an implicit parameter
I'm going to treat these as problems for another day. They are all exotic.  -}</span><span>
</span><span id="line-315"></span><span>
</span><span id="line-316"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
              Evidence variables
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-321"></span><span>
</span><span id="line-322"></span><span class="annot"><a href="GHC.Core.Predicate.html#isEvVar"><span class="hs-identifier hs-type">isEvVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-323"></span><span id="isEvVar"><span class="annot"><span class="annottext">isEvVar :: TyCoVar -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isEvVar"><span class="hs-identifier hs-var hs-var">isEvVar</span></a></span></span><span> </span><span id="local-6989586621680850441"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850441"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isEvVarType"><span class="hs-identifier hs-var">isEvVarType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; PredType
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850441"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span class="annot"><a href="GHC.Core.Predicate.html#isDictId"><span class="hs-identifier hs-type">isDictId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-326"></span><span id="isDictId"><span class="annot"><span class="annottext">isDictId :: TyCoVar -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isDictId"><span class="hs-identifier hs-var hs-var">isDictId</span></a></span></span><span> </span><span id="local-6989586621680850440"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850440"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PredType -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isDictTy"><span class="hs-identifier hs-var">isDictTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; PredType
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680850440"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-327"></span></pre></body></html>